.class public Lcom/instagram/android/feed/ui/StickyHeaderListView;
.super Landroid/widget/FrameLayout;
.source "StickyHeaderListView.java"

# interfaces
.implements Landroid/widget/AbsListView$OnScrollListener;


# static fields
.field private static k:Ljava/lang/Boolean;


# instance fields
.field protected a:Z

.field protected b:Z

.field protected c:Landroid/widget/ListView;

.field protected d:Lcom/instagram/android/feed/ui/k;

.field protected e:Landroid/view/View;

.field protected f:Landroid/view/View;

.field protected g:Landroid/view/View;

.field protected h:I

.field protected i:Ljava/lang/Object;

.field protected j:I


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 119
    invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 63
    const/4 v0, -0x1

    iput v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->h:I

    .line 67
    const/4 v0, 0x0

    iput v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->j:I

    .line 120
    return-void
.end method

.method private a(Landroid/view/View;Z)V
    .locals 3
    .parameter
    .parameter

    .prologue
    .line 219
    if-eqz p2, :cond_0

    .line 221
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    invoke-virtual {p1}, Landroid/view/View;->getBottom()I

    move-result v1

    iget-object v2, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    invoke-virtual {v2}, Landroid/view/View;->getMeasuredHeight()I

    move-result v2

    sub-int/2addr v1, v2

    invoke-static {v0, v1}, Lcom/instagram/android/feed/ui/l;->a(Landroid/view/View;I)V

    .line 228
    :goto_0
    return-void

    .line 225
    :cond_0
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/instagram/android/feed/ui/l;->a(Landroid/view/View;I)V

    goto :goto_0
.end method

.method private a()Z
    .locals 2

    .prologue
    .line 86
    sget-object v0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->k:Ljava/lang/Boolean;

    if-nez v0, :cond_0

    .line 87
    invoke-virtual {p0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/instagram/n/k;->b(Landroid/content/Context;)I

    move-result v0

    const/16 v1, 0x140

    if-le v0, v1, :cond_1

    const/4 v0, 0x1

    :goto_0
    invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    sput-object v0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->k:Ljava/lang/Boolean;

    .line 89
    :cond_0
    sget-object v0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->k:Ljava/lang/Boolean;

    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v0

    return v0

    .line 87
    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private b()V
    .locals 3

    .prologue
    .line 262
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->f:Landroid/view/View;

    if-eqz v0, :cond_1

    .line 263
    const/4 v0, 0x1

    :goto_0
    iget-object v1, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    invoke-virtual {v1}, Landroid/widget/ListView;->getChildCount()I

    move-result v1

    if-ge v0, v1, :cond_1

    .line 264
    iget-object v1, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    invoke-virtual {v1, v0}, Landroid/widget/ListView;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    .line 265
    iget-object v2, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->f:Landroid/view/View;

    invoke-virtual {v2}, Landroid/view/View;->getId()I

    move-result v2

    invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    .line 266
    if-eqz v1, :cond_0

    .line 267
    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Landroid/view/View;->setVisibility(I)V

    .line 263
    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 271
    :cond_1
    return-void
.end method

.method private b(Landroid/view/View;Z)V
    .locals 4
    .parameter
    .parameter

    .prologue
    const/4 v1, 0x0

    .line 238
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    iget-object v2, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->g:Landroid/view/View;

    if-ne v0, v2, :cond_0

    .line 254
    :goto_0
    return-void

    .line 243
    :cond_0
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    invoke-virtual {v0}, Landroid/view/View;->getId()I

    move-result v0

    invoke-virtual {p1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    .line 245
    if-eqz p2, :cond_1

    .line 246
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    .line 247
    invoke-virtual {v3, v1}, Landroid/view/View;->setVisibility(I)V

    goto :goto_0

    .line 250
    :cond_1
    invoke-virtual {p1}, Landroid/view/View;->getTop()I

    move-result v0

    if-nez v0, :cond_3

    const/4 v0, 0x1

    move v2, v0

    .line 251
    :goto_1
    if-eqz v2, :cond_4

    move v0, v1

    :goto_2
    invoke-virtual {v3, v0}, Landroid/view/View;->setVisibility(I)V

    .line 252
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    if-eqz v2, :cond_2

    const/16 v1, 0x8

    :cond_2
    invoke-virtual {v0, v1}, Landroid/view/View;->setVisibility(I)V

    goto :goto_0

    :cond_3
    move v2, v1

    .line 250
    goto :goto_1

    .line 251
    :cond_4
    const/4 v0, 0x4

    goto :goto_2
.end method

.method private b(I)Z
    .locals 2
    .parameter

    .prologue
    .line 204
    iget v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->h:I

    if-ne p1, v0, :cond_0

    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->i:Ljava/lang/Object;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->i:Ljava/lang/Object;

    iget-object v1, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->d:Lcom/instagram/android/feed/ui/k;

    invoke-interface {v1, p1}, Lcom/instagram/android/feed/ui/k;->getItem(I)Ljava/lang/Object;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_1

    :cond_0
    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method private c(I)Landroid/view/View;
    .locals 4
    .parameter

    .prologue
    .line 274
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->d:Lcom/instagram/android/feed/ui/k;

    iget-object v1, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->f:Landroid/view/View;

    invoke-interface {v0, p1, v1, p0}, Lcom/instagram/android/feed/ui/k;->a(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->f:Landroid/view/View;

    .line 275
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->f:Landroid/view/View;

    iget-object v1, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    invoke-virtual {v1}, Landroid/widget/ListView;->getWidth()I

    move-result v1

    const/high16 v2, 0x4000

    invoke-static {v1, v2}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v1

    iget-object v2, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    invoke-virtual {v2}, Landroid/widget/ListView;->getHeight()I

    move-result v2

    const/high16 v3, -0x8000

    invoke-static {v2, v3}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v2

    invoke-virtual {v0, v1, v2}, Landroid/view/View;->measure(II)V

    .line 279
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->f:Landroid/view/View;

    return-object v0
.end method

.method private c()V
    .locals 6

    .prologue
    const/4 v5, 0x1

    const/4 v2, 0x0

    .line 302
    invoke-virtual {p0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->getChildCount()I

    move-result v3

    move v1, v2

    .line 303
    :goto_0
    if-ge v1, v3, :cond_1

    .line 304
    invoke-virtual {p0, v1}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->getChildAt(I)Landroid/view/View;

    move-result-object v0

    .line 305
    instance-of v4, v0, Landroid/widget/ListView;

    if-eqz v4, :cond_0

    .line 306
    check-cast v0, Landroid/widget/ListView;

    invoke-virtual {p0, v0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->setListView(Landroid/widget/ListView;)V

    .line 303
    :cond_0
    add-int/lit8 v0, v1, 0x1

    move v1, v0

    goto :goto_0

    .line 311
    :cond_1
    new-instance v0, Landroid/view/View;

    invoke-virtual {p0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/view/View;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->g:Landroid/view/View;

    .line 312
    new-instance v0, Landroid/widget/FrameLayout$LayoutParams;

    const/4 v1, -0x1

    const/16 v3, 0x30

    invoke-direct {v0, v1, v5, v3}, Landroid/widget/FrameLayout$LayoutParams;-><init>(III)V

    .line 314
    iget-object v1, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->g:Landroid/view/View;

    invoke-virtual {v1, v0}, Landroid/view/View;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 315
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->g:Landroid/view/View;

    invoke-virtual {v0, v2}, Landroid/view/View;->setBackgroundColor(I)V

    .line 317
    iput-boolean v5, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->a:Z

    .line 318
    return-void
.end method


# virtual methods
.method protected a(I)V
    .locals 6
    .parameter

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 151
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->d:Lcom/instagram/android/feed/ui/k;

    if-nez v0, :cond_0

    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    if-eqz v0, :cond_0

    .line 152
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    invoke-virtual {v0}, Landroid/widget/ListView;->getAdapter()Landroid/widget/ListAdapter;

    move-result-object v0

    check-cast v0, Lcom/instagram/android/feed/ui/k;

    invoke-virtual {p0, v0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->setAdapter(Lcom/instagram/android/feed/ui/k;)V

    .line 155
    :cond_0
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->d:Lcom/instagram/android/feed/ui/k;

    if-eqz v0, :cond_3

    iget-boolean v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->b:Z

    if-eqz v0, :cond_3

    .line 158
    iget v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->j:I

    sub-int v3, p1, v0

    .line 159
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->d:Lcom/instagram/android/feed/ui/k;

    invoke-interface {v0, v3}, Lcom/instagram/android/feed/ui/k;->getItem(I)Ljava/lang/Object;

    move-result-object v4

    .line 162
    invoke-direct {p0, v3}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->b(I)Z

    move-result v0

    if-eqz v0, :cond_7

    .line 163
    iget-object v5, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    .line 165
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->d:Lcom/instagram/android/feed/ui/k;

    invoke-interface {v0, v3}, Lcom/instagram/android/feed/ui/k;->a(I)Z

    move-result v0

    if-eqz v0, :cond_4

    iget v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->j:I

    add-int/2addr v0, v3

    invoke-direct {p0, v0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c(I)Landroid/view/View;

    move-result-object v0

    :goto_0
    iput-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    .line 169
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    if-eq v5, v0, :cond_6

    .line 170
    invoke-virtual {p0, v5}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->removeView(Landroid/view/View;)V

    move v0, v1

    .line 174
    :goto_1
    iput v3, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->h:I

    .line 175
    iput-object v4, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->i:Ljava/lang/Object;

    .line 180
    :goto_2
    iget-object v3, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    invoke-virtual {v3, v2}, Landroid/widget/ListView;->getChildAt(I)Landroid/view/View;

    move-result-object v3

    .line 181
    if-eqz v3, :cond_1

    .line 182
    invoke-virtual {v3}, Landroid/view/View;->getBottom()I

    move-result v4

    iget-object v5, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    invoke-virtual {v5}, Landroid/view/View;->getMeasuredHeight()I

    move-result v5

    if-gt v4, v5, :cond_5

    .line 184
    :goto_3
    invoke-direct {p0, v3, v1}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->a(Landroid/view/View;Z)V

    .line 185
    invoke-direct {p0, v3, v1}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->b(Landroid/view/View;Z)V

    .line 188
    :cond_1
    if-eqz v0, :cond_2

    .line 189
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->e:Landroid/view/View;

    invoke-virtual {p0, v0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->addView(Landroid/view/View;)V

    .line 192
    :cond_2
    invoke-direct {p0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->b()V

    .line 194
    :cond_3
    return-void

    .line 165
    :cond_4
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->g:Landroid/view/View;

    goto :goto_0

    :cond_5
    move v1, v2

    .line 182
    goto :goto_3

    :cond_6
    move v0, v2

    goto :goto_1

    :cond_7
    move v0, v2

    goto :goto_2
.end method

.method protected onAttachedToWindow()V
    .locals 1

    .prologue
    .line 293
    invoke-super {p0}, Landroid/widget/FrameLayout;->onAttachedToWindow()V

    .line 294
    iget-boolean v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->a:Z

    if-nez v0, :cond_0

    .line 295
    invoke-direct {p0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c()V

    .line 297
    :cond_0
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->b:Z

    .line 298
    return-void
.end method

.method protected onFinishInflate()V
    .locals 1

    .prologue
    .line 284
    invoke-super {p0}, Landroid/widget/FrameLayout;->onFinishInflate()V

    .line 285
    iget-boolean v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->a:Z

    if-nez v0, :cond_0

    .line 286
    invoke-direct {p0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c()V

    .line 288
    :cond_0
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->b:Z

    .line 289
    return-void
.end method

.method public onScroll(Landroid/widget/AbsListView;III)V
    .locals 1
    .parameter "view"
    .parameter "firstVisibleItem"
    .parameter "visibleItemCount"
    .parameter "totalItemCount"

    .prologue
    .line 144
    invoke-direct {p0}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->a()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 145
    invoke-virtual {p0, p2}, Lcom/instagram/android/feed/ui/StickyHeaderListView;->a(I)V

    .line 147
    :cond_0
    return-void
.end method

.method public onScrollStateChanged(Landroid/widget/AbsListView;I)V
    .locals 0
    .parameter "view"
    .parameter "scrollState"

    .prologue
    .line 130
    return-void
.end method

.method public setAdapter(Lcom/instagram/android/feed/ui/k;)V
    .locals 0
    .parameter "adapter"

    .prologue
    .line 99
    iput-object p1, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->d:Lcom/instagram/android/feed/ui/k;

    .line 100
    return-void
.end method

.method public setListView(Landroid/widget/ListView;)V
    .locals 1
    .parameter "lv"

    .prologue
    .line 108
    iput-object p1, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    .line 109
    iget-object v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->c:Landroid/widget/ListView;

    invoke-virtual {v0}, Landroid/widget/ListView;->getHeaderViewsCount()I

    move-result v0

    iput v0, p0, Lcom/instagram/android/feed/ui/StickyHeaderListView;->j:I

    .line 110
    return-void
.end method
